package wrapper

import (
	"context"
	"github.com/micro/go-micro/server"
	"github.com/micro/go-micro/util/log"
)

//LogWrapper
func LogWrapper(hf server.HandlerFunc) server.HandlerFunc {
	return func(ctx context.Context, req server.Request, rsp interface{}) error {
		log.Info("[" + req.Service() + " : " + req.Endpoint() + "] : " + "Start")
		err := hf(ctx, req, rsp)
		log.Info("[" + req.Service() + " : " + req.Endpoint() + "] : " + "End")
		return err
	}
}
